<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <main>
        <li id="content"></li>
        <ol id="result">
        </ol>
    </main>
</body>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
    const arr = [83, 88, 94, 124, 132, 135, 143, 153, 159, 166, 181, 189, 191, 195, 206, 224, 231, 238, 242, 255, 267, 271, 284, 297, 302, 312, 320, 328, 334, 343, 350, 354, 358, 361, 363, 417, 449, 451, 453, 455, 462, 467, 471, 478, 482, 494, 509, 513, 515, 540, 546, 549, 555, 566, 575, 577, 583, 587, 593, 601, 602, 610, 613, 618, 622, 632, 664, 675, 677, 694, 807, 814, 828, 833, 837, 844, 863, 866, 869, 871, 874, 876, 878, 880, 884, 902, 906, 911, 922, 925, 938, 940, 964, 980, 991, 1005, 1058];
    // const arr = [83,88];

    const contentLi = document.querySelector("#content");
    const resultOl = document.querySelector("#result");


    function ajax(v) {
        return axios({
            url: "http://127.0.0.1:8083/typeContent/queryRow",
            method: 'post',
            data: { t_type_content_pk: v }
        });

    }

    async function doStart() {
        for (const  v of arr) {
            const result = await ajax(v);
            if (result.data.status > 0) {
                createLi(result.data.result_data);
            }
        }
    }

    function createLi(data) {
        contentLi.innerHTML = data.content;
        const a = Array.from(contentLi.querySelectorAll("li"));

        const resultArr = a.map(v => v.innerHTML);
        console.log(resultArr);

        const jsonStr = JSON.stringify(resultArr);
        const sql = `update t_type_content set content = '${jsonStr}' where t_type_content_pk = ${data.t_type_content_pk};`

        const li = document.createElement("li");
        li.innerText = sql;
        resultOl.appendChild(li);
    }

    doStart();

</script>

</html>